# load packages
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.4.4     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(plotly)
## 
## Attaching package: 'plotly'
## 
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following object is masked from 'package:graphics':
## 
##     layout
library(sf)
## Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 8.2.1; sf_use_s2() is TRUE
# load data
data = read_rds("cstates_uerates_crates_combined.rds")

filtered_data <- filter(data, NAME ==  "Illinois" | NAME == "California" | NAME == "Idaho" | NAME == "Indiana")

unemployment_plot <-  plot_ly(filtered_data, x = ~Year, y = ~Unemplyrate, type = 'scatter', mode = 'lines', color = ~NAME) 

unemployment_plot<- unemployment_plot %>% layout(title = 'Unemployment Rate over Time',

         xaxis = list(title = 'Year'),

         yaxis = list (title = 'Unemployment Rate'))


unemployment_plot
crime_plot = ggplot(filtered_data, aes(x=Year, y = crime_rate, color = NAME)) +
  geom_point() +
  geom_line()

crime_plot